<?php
declare(strict_types=1);
namespace Field;

class AuthNickConfigConst
{
    public const pk='';
    public const index=['NickID'];
	public const fields=['NickID','CreateAt','UpdateAt','Config'];
	public const comment=['NickID'=>'','CreateAt'=>'','UpdateAt'=>'','Config'=>''];
	/*
    * @Field NickID
    * @Type int(10) unsigned
    * @Collation 
    * @Null NO
    * @Key PRI
    * @Default 
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 
    */
    public const NickID = 'NickID';
    /*
    * @Field CreateAt
    * @Type timestamp
    * @Collation 
    * @Null NO
    * @Key 
    * @Default CURRENT_TIMESTAMP
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 
    */
    public const CreateAt = 'CreateAt';
    /*
    * @Field UpdateAt
    * @Type timestamp
    * @Collation 
    * @Null YES
    * @Key 
    * @Default CURRENT_TIMESTAMP
    * @Extra on update CURRENT_TIMESTAMP
    * @Privileges select,insert,update,references
    * @Comment 
    */
    public const UpdateAt = 'UpdateAt';
    /*
    * @Field Config
    * @Type text
    * @Collation utf8mb4_general_ci
    * @Null NO
    * @Key 
    * @Default 
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 
    */
    public const Config = 'Config';
}

class AuthNickConfigColumns
{
public  int $NickID;
   public  string $CreateAt;
   public  ?string $UpdateAt='';
   public  string $Config;
	public function toArray():array
	{
		return [
'NickID'=>$this->NickID,
    'CreateAt'=>$this->CreateAt,
    'UpdateAt'=>$this->UpdateAt,
    'Config'=>$this->Config,        ];
	}
}

class AuthNickConfigRow
{
	public AuthNickConfigColumns $data;
	public function toArray():array
	{
		return $this->data->toArray();
    }

    public function getValue(string $field):string|int|null
    {
        return match ($field){
        'NickID' => $this->data->NickID,
        'CreateAt' => $this->data->CreateAt,
        'UpdateAt' => $this->data->UpdateAt,
        'Config' => $this->data->Config, default=>null
        };
    }

    public function __construct(array $data)
    {
        $this->data = new AuthNickConfigColumns();
        isset($data['NickID']) && $this->data->NickID = (int)$data['NickID'];
           isset($data['CreateAt']) && $this->data->CreateAt = (string)$data['CreateAt'];
           isset($data['UpdateAt']) && $this->data->UpdateAt = (string)$data['UpdateAt'];
           isset($data['Config']) && $this->data->Config = (string)$data['Config'];
    }
}
?>